<?php echo $this->render($this->includeDir . '/toolbar.php');?>
<?php echo $this->flashMessage();?>
<?php 
	$flagMember = false;
	$info = new Zendvn_System_Info();
	$groupInfo = current($info->getGroupInfo());
	if($groupInfo['id'] == 4){
		$flagMember = true;
	}


	$arrParam = $this->arrParam;
	$this->Item['name'] = Zendvn_Filter_Filter::filterContent($this->Item['name']);
    $full_name 		= $this->formText('full_name',$this->Item['full_name'],array('class'=>'width-300 bg-green2 floatLeft' ));
	$website 		= $this->formText('website',$this->Item['website'],array('class'=>'width-300 bg-green2 floatLeft' ));
    $country 		= $this->formText('country',$this->Item['country'],array('class'=>'width-300 bg-green2 floatLeft' ));
    $email 		    = $this->formText('email',$this->Item['email'],array('class'=>'width-300 bg-green2 floatLeft' ));
    $city 		    = $this->formText('city',$this->Item['city'],array('class'=>'width-300 bg-green2 floatLeft' ));

    $occupation       = $this->formText('occupation',implode($this->Item['occupation'],","),array('class'=>'width-300 bg-green2 floatLeft' ));

	$options 	= array('pending'=>$this->translate('Pending'), 'inactive'=>$this->translate('Inactive'),'active'=>$this->translate('Active'));
	if($flagMember){
		$statusVal	= empty($this->Item['status'])?'pending':$this->Item['status'];
		$status		= $this->formText('lbl_status', $options[$statusVal],array('class'=>'width-150', 'disabled' => 'true'));
		$status		.= $this->formHidden('status', $statusVal);
	}else{
		$status 	= $this->formSelect('status',$this->Item['status'],array('class'=>'width-150'),$options);
	}
	
	$formHelp 		= '';	
	$config = new Zendvn_Controller_Config(array('module'=>$arrParam['module'],
												'fileConfig'=>'news-category.ini',
												'section'=>'tooltip'));
	$arrTooltip = $config->getConfig('item');	
	if(count($arrTooltip)>0){
		foreach ($arrTooltip as $key => $val){
		   if($key=='d_summary') $attribs = array('leftOffset'=>-305);
		   if($key=='d_content') $attribs = array('leftOffset'=>-305);
		   $formHelp  .= $this->cmsFormHelp('.form-table #' . $key, $this->translate($val), $attribs); 
		}
	}
	
	 if(count($this->errors)>0){	
	 	foreach ($this->errors as $key => $val){	 		
	 		$$key .= $this->cmsError($key,$val);	
	 		$selector = '.form-table #' . $key . '-error';
	 		$options = array('type'=>'error','name'=>'#' .$key);
	 		$formHelp  .= $this->cmsFormHelp($selector, $this->translate($val),null,$options);
	 		
	 	}
	 }
	 $arrRow = array(
					array('label'=>$this->translate('Full Name'),'input'=>$full_name),
					array('label'=>$this->translate('Website'),'input'=>$website),
					array('label'=>$this->translate('Country'),'input'=>$country),
					array('label'=>$this->translate('Email'),'input'=>$email),
					array('label'=>$this->translate('City'),'input'=>$city),
					array('label'=>$this->translate('Status'),'input'=>$status),
					array('label'=>$this->translate('Occupation'),'input'=>$occupation),
					);
	$tdForm = $this->partialLoop('row.php',$arrRow);
	
?>
<script type="text/javascript">
	$(document).ready(function() {
		<?php echo $formHelp;?>
	});
</script>
<div id="element-box">
	<div class="m">
		<div class="form-table">
        	<fieldset class="admin-fieldset">
                <legend class="admin-legend"><?php echo $this->translate('Form detail')?></legend>
            	<table width="100%" border="0">
                	<?php echo $tdForm;?>
                </table>
                <div class="clr"></div>
        	</fieldset>  
        </div>
       
        <div class="clr"></div>
	</div>
</div>
<div id="append_cid">
    <?php
    $cat_id = array();
    if(!empty($this->Item['cat_id'])){
        $cat_id = json_decode($this->Item['cat_id'],true);
        foreach($cat_id as $val){
            echo '<input type="hidden" class="cat_id" name="cat_id[]" id="cat_id" value="'.$val.'">';
        }
    }


    ?>
</div>


<div id="supplier_select_dialog" style="display: none">
    <div>
            <?php
            if(!empty($this->slbCategory)){
                $html = '';
                foreach($this->slbCategory as  $val){
                    $checked = '';
                    if(in_array($val['id'],$cat_id)) $checked = 'checked="checked"';
                    $html.= '<div class="filter_item">
                            <label style="font-size: 12px;line-height: 30px">
                                <input type="checkbox" '.$checked.' attr="'.$val['name'].'" style="margin-right: 5px" class="listCategory" name="listCategoryID[]" value="'.$val['id'].'" />'.$val['name'].'
                            </label>
                         </div>';
                }
                echo $html;
            }
            ?>
        <div class="clear"></div>
    </div>
</div>